package com.cosina.game.tank;

import com.cosina.game.tank.view.ButtonAreaView;
import com.cosina.game.tank.view.WarView;

import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.Window;

public class TankGame extends Activity {

    private  WarView warField;
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        ImageManager.init(this);
        requestWindowFeature(Window.FEATURE_NO_TITLE);

        startGame();
    }
	
	public void startGame(){
		setContentView(R.layout.gameview);
        
        warField = (WarView)findViewById(R.id.warViewId);
        ButtonAreaView buttonAreaView = (ButtonAreaView)findViewById(R.id.brViewId);
        buttonAreaView.setDirectionAdapterOwner(warField);
	}
	
	
	
	@Override
	public boolean onTrackballEvent(MotionEvent event) {
		
		if(event.getAction() == MotionEvent.ACTION_UP){
			 warField.war.justiceTank.shot();
			 return true;
		}
		return super.onTrackballEvent(event);
	}
}